/**
 * Created by Wang on 2018/3/5.
 */
layui.use("layer", function() {
    layer = layui.layer;
jQuery.support.cors = true;	
    $.ajaxSetup({
        timeout: 30000,
        beforeSend: function (xhr) {//发送请求前触发

        },
        dataFilter: function (data, type) {
            return data;
        },
        success: function (data) {

        },
        error: function (xhr, status, e) {
//          console.dir(e);
            //layer.msg("请求错误！请稍候重试",{icon:2,time:3000});
        },
        complete: function (xhr, status) {
        }
    });
    var loadingIndex;
    $(document).ajaxStart(function () {
        loadingIndex = layer.load(3, {shade: [0.5, '#fff']})
        //	 	setTimeout(alert(1),5000);//0.1透明度的白色背景
    }).ajaxComplete(function (request) {
        //	  	layer.close(loadingIndex);
    }).ajaxStop(function (request) {
        layer.close(loadingIndex);
    });
})